
<div id="wrapper-content" >
    <table class="titrepage" width="100%">
        <tr>
            <td >La liste des commandes</td>
            <td align="right">Total | <?php echo $total ?> </td>
        </tr>
    </table>
    <div align="left">
        <?php
            $options = array(
                'all'=>'Tous les',
                'livre' => 'Livré',
                'non' => 'Pas encore livré',
            );
        ?>
        <?php echo form_open('commandes/search_commandes') ?>
            <table>
                <tr>
                    <td>Recherche par état de livraison: </td>
                    <td><?php echo form_dropdown('search_livre', $options,$selected_livre);?></td>
                    <td><input type="submit" name="submit" value="Recherche"/></td>
                </tr>
            </table>
        <?php form_close(); ?>
        </div>
        <?php if($total>0){ ?>
        <table align="center" width="100%" class="list">
            <thead>
                <tr>
                    <th>Client</th>
                    <th>Date</th>
                    <th>Montant</th>
                    <th>Etat paiement</th>
                    <th>Livraison</th>
                    <th colspan="2">Action</th>
                </tr>
            </thead>
            <?php foreach ($commandes as $aRow): ?>
            <?php $pattern = '%d-%m-%Y';
                  $date = mdate($pattern,$aRow['dat']);?>
                <tr>
                    <td><?php echo $aRow['display_name']; ?></td>
                    <td><?php echo $date; ?></td>
                    <td><?php echo $aRow['montant']; ?></td>
                    <td style="color: red"><?php echo $aRow['status']; ?></td>
            <?php if ($aRow['livre'] == NULL) {
            ?>
                    <td width="70px">
                        <a class="supprimer" href="#" style="color: red">Pas encore livrées</a>
                        <div style="display:none">
                                            Confirmer <br/>
                            <a href="<?php echo site_url('test/delivered') . '/' . $aRow['id'].'/'.$aRow['user_id']; ?>"> <img border="0"src="<?php echo root_url('zoo-market') . 'assets/admin/' ?>images/oui.png"/></a>
                            <a class="non" href="#" ><img  border="0"src="<?php echo root_url('zoo-market') . 'assets/admin/' ?>images/non.png"/></a>
                        </div>
                    </td>
            <?php } else { ?>
                    <td width="70px"  style="color: blue;">Livré</td>
            <?php } ?>
                <td width="70px"><a  href="<?php echo site_url('commandes/detail_commandes') . '/' . $aRow['id']; ?>" ><img border="0"src="<?php echo root_url('zoo-market') . 'assets/admin/' ?>images/detail.png"/></a></td>
                <td width="70px">
                    <a class="supprimer" href="#" ><img border="0"src="<?php echo root_url('zoo-market') . 'assets/admin/' ?>images/supprimer.png"/></a>
                    <div style="display:none">
                        		    	Confirmer <br/>
                        <a href="<?php echo site_url('commandes/delete_commandes') . '/' . $aRow['id'] . '/' . $per_page . '/' . $off_set; ?>"> <img border="0"src="<?php echo root_url('zoo-market') . 'assets/admin/' ?>images/oui.png"/></a>
                    <a class="non" href="#" ><img  border="0"src="<?php echo root_url('zoo-market') . 'assets/admin/' ?>images/non.png"/></a>
                </div>
            </td>
        </tr>
<?php endforeach; ?>
            </table>
<?php echo $pagination; ?>
    <?php  }else{?>
    <h3 align="left">Not found!!!</h3>
    <?php }?>
</div>
<!--END wrapper-content-->
